<?php
/**
 * Created by PhpStorm.
 * User: 徐州
 * Date: 2017/5/8
 * Time: 16:24
 */

namespace App\Http\Controllers;

use App\App\Services\VMSService;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;

class UploadController extends Controller
{
    public function upload(Request $request, VMSService $VMSService)
    {
        $now = Carbon::now();
        $this->today = $now->toDateString();
        if ($request->isMethod('post')) {
            print_r($VMSService->uploadVideoTmp($request->file('file')));
            echo PHP_EOL;
            print_r($VMSService->ftpUploadVideo());
        }
        $str = '{"ip": "192.168.1.1", "voted_at": 11111111, "item_id": "fghjjkkkkkk", "user": "admin"}';
        Redis::rpush('logs:fghjkl:' . $this->today, $str);
        return view('upload');
    }
}
